import React, { Component } from 'react'
import { observer, inject } from 'mobx-react';
import { Divider } from 'antd'

@inject("store")//拆分容器组件和ui组件
@observer//监控仓库里的数据变化
class One extends Component {
  componentDidMount() {
    this.props.store.getData();
  }
  render() {
    // console.log(this.props.store.n)
    return (
      <div>
        <Divider orientation="left">自动监听,store中的值和使用方法通过props传入</Divider>
        {this.props.store.n} - {this.props.store.age}
        <button onClick={this.props.store.changeData}>+</button>
      </div>
    )
  }
}
export default One
